﻿Imports Microsoft.VisualBasic

Public Module General
    Public Sub FilterBySquadron(ByVal dataSource As SqlDataSource, ByVal squadrons As ListBox)
        Dim sb As New System.Text.StringBuilder
        For Each item As WebControls.ListItem In squadrons.Items
            If item.Selected Then
                sb.Append(item.Value)
                sb.Append(",")
            End If
        Next
        Dim moires As String = sb.ToString
        If moires.Length > 0 Then
            moires = Left(moires, moires.Length - 1)
            dataSource.FilterExpression = "id_Moira in (" + moires + ")"
        Else
            dataSource.FilterExpression = "--"
        End If
        'HttpContext.Current.Response.Write(dataSource.FilterExpression)
        'HttpContext.Current.Response.End()
    End Sub

End Module
